package com.xiaolong.redis.factory;

import com.xiaolong.common.utils.SpringUtil;
import com.xiaolong.redis.enums.LockBlockEnum;
import com.xiaolong.redis.handle.InterruptHandler;
import com.xiaolong.redis.handle.LockHandler;
import com.xiaolong.redis.handle.QueueLockHandler;

public class LockHandlerFactory {

    public static LockHandler routingLockHandler(LockBlockEnum lockBlockEnum){
       if (lockBlockEnum.getTypeCode()==LockBlockEnum.QUEUE.getTypeCode()){
           return SpringUtil.getBean(QueueLockHandler.class);
       }
        return SpringUtil.getBean(InterruptHandler.class);
    }
}
